home *** CD-ROM | disk | FTP | other *** search
/ Linux Cubed Series 7: Sunsite / Linux Cubed Series 7 - Sunsite Vol 1.iso / system / network / samba / smb-info / encrypt.txt < prev    next >
Encoding:
Text File  |  1996-11-17  |  2.8 KB  |  83 lines

  1. Extract from  'Protocols for X/Open PC Internetworking: SMB, Version 2'
  2. X/Open CAE Specification (1992).
  3.  
  4.  
  5. Appendix D
  6.  
  7. SMB Encryption Techniques
  8.  
  9. D.1 SMB Authentication
  10.  
  11. The SMB authentication scheme is based upon the server knowing a
  12. particular encrypted form of the users password, the client system
  13. constructing that same encrypted form based upon user input, and the
  14. client passing that encrypted form in a secure fashion to the server so
  15. that it can verify the clients knowledge.
  16.  
  17. The scheme uses the DES encryption function in block mode; that is,
  18. there is a function E(K,D) which accepts a 7 byte key (K) and 8-byte
  19. data block (D) and produces an 8-byte encrypted data block as its
  20. value. If the data to be encrypted is longer than 8 bytes, the
  21. encryption function is applied to each block of 8 bytes in sequence and
  22. the results appended together. If the key is longer than 7 bytes, the
  23. data is first completely encrypted using the first 7 bytes of the key,
  24. then the second 7 bytes, etc., appending the results each time. In
  25. other words:
  26.  
  27.         E(K0 K1, D0 D1) = E(K0,D0)E(K0,D1)E(K1,D0)E(K1D1)
  28.  
  29. D.1.1 SMB negprot response
  30.  
  31. The SMBnegprot response field smb_crtpykey is the result of computing:
  32.  
  33.         C8 = E(P7,S8)
  34.  
  35. where:
  36.         P7 is a 7 byte string which is non-repeating. This is usually a
  37.         combination of the time (in seconds since January 1, 1970) and
  38.         a counter which is incremented after each use.
  39.  
  40.         S8 is an 8-byte string whose value is ???????? (eight question marks).
  41.  
  42. D.1.2 SMBtcon, SMBtconX, SMBsesssetupX Requests
  43.  
  44. The client system may send an encrypted password in any one of these
  45. requests. The server must validate that encrypted password by
  46. performing the same computations the client did to create it, and
  47. ensuring the strings match. The server must compute :
  48.  
  49.         P16 = E(P14,S8)
  50.  
  51. and:
  52.  
  53.         P24 = E(P21,C8)
  54.  
  55. where:
  56.         P14 is a 14-byte string containing the users password in
  57.         cleartest, padded with spaces.
  58.  
  59.         S8 is the 8-byte well-known string (see above).
  60.  
  61.         P21 is a 21-byte string obtained by appending 5 null (0) bytes
  62.         to the string P16, just computed.
  63.  
  64.         C8 is the value of smb_cyptkey send in the SMBnegprot response
  65.         for this connection.
  66.  
  67. The final string, P24, should be compared to the encrypted string in
  68. the request :
  69.  
  70.         the smb_passwd field in SMBtcon
  71.  
  72.         the smb_spasswd field in SMBtconX
  73.  
  74.         the smb_apasswd field in SMBsessetupX
  75.  
  76. If they do not match, it is possible the client system was incapable of
  77. encryption; if so, the string should be the users password in
  78. cleartest. The server should try to validate the strin, treating is as
  79. the users unencrypted password. If this validation fails as well, the
  80. password (and the request) should be rejected.
  81.  
  82.  
  83.